// weather.h
#ifndef WEATHER_H
#define WEATHER_H

#include <QWidget>  // 只需要包含直接基类
#include <QPainter>
#include <QColor>
#include "weather_json.h"

class weather : public QWidget
{
    Q_OBJECT

public:
    explicit weather(QWidget *parent = nullptr);
private:
    QColor color;
    // 设置背景
    void set_color(QColor color);
    // 绘制事件
    void paintEvent(QPaintEvent *event) override;
    // 设置温度
    void set_temp(const QVector<WeatherData> &weatherData);
    void drawTemperatureChart(QPainter &painter, const QRect &rect, const int temp[], const QString &title, const QColor &color);
protected:

public slots:
    void handleWeatherData(const QVector<WeatherData> &weatherData);
private:
    QColor lind_color;
    int high_temp[7] = {26, 23, 22, 25, 25, 24, 22};
    int low_temp[7] = {26, 23, 22, 25, 25, 24, 22};
private:
//    void drawTemperatureChartWithGradient(QPainter &painter, const QRect &rect,
//                                         const QVector<int> &highTemp,
//                                         const QVector<int> &lowTemp);
};

#endif // WEATHER_H
